home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d2 / vampire2.arc / VAMPIRE.C < prev    next >
Text File  |  1989-04-28  |  2KB  |  77 lines

  1. #include <stdio.h>
  2.  
  3. #define    SEGMENT    0xf000
  4.  
  5. main(argc,argv)
  6. int argc;
  7. char *argv[];
  8. {
  9.     static char Sccsid[] = "@(#)vampire.c 2.0 - Ryugen Fisher, 1987";
  10.     unsigned char file[16];
  11.  
  12.     if(argc > 1)
  13.     {
  14.          printf("         vampire - sucks the BIOS rom contents out of the PC on which\n");
  15.          printf("      it is executed. The rom contents are placed into          \n");
  16.          printf("      binary files named 'BIOS.ROM' and OTHER.ROM                  \n");
  17.          printf("      The contents of those files can then be HEX'd with          \n");
  18.          printf("      ZAPLOAD by T. Jennings, HEX86 by Manx, or                  \n");
  19.          printf("      BIN2HEX by Robert Pasky                          \n");
  20.          printf("      version 2.0 by En-Crypts SoftSystems                        \n");
  21.          exit(0);
  22.     }
  23.     /*
  24.     ** initialize
  25.     */
  26.     
  27.         printf("ROM contents are being copied to files BIOS8.ROM,\n");
  28.         printf("BIOS16.ROM, BIOS32.ROM, and OTHER.ROM\n");
  29.  
  30.     /*
  31.     ** extract bios rom contents starting at 'offset'
  32.     */
  33.  
  34.     strcpy(file,"BIOS8.ROM");
  35.     rom2file(file,0x2000,0xe000);    /* where IBM-PC BIOS resides */
  36.  
  37.     strcpy(file,"BIOS16.ROM");
  38.     rom2file(file,0x4000,0xe000);    /* where IBM-PC BIOS resides */
  39.  
  40.     strcpy(file,"BIOS32.ROM");
  41.     rom2file(file,0x8000,0xe000);    /* where IBM-PC BIOS resides */
  42.  
  43.     strcpy(file,"BIOS64.ROM");
  44.     rom2file(file,0x10000,0xe000);    /* where IBM-PC BIOS resides */
  45.  
  46.     strcpy(file,"OTHER.ROM");
  47.     rom2file(file,0x8000,0x6000);    /* where basic is (if present) */
  48. }
  49.  
  50. /*
  51. ** create a file containing the contents of the specified memory
  52. */
  53. rom2file(fname,siz,off)
  54. unsigned char *fname;
  55. unsigned int off,siz;
  56. {
  57.     register unsigned int size, offset;
  58.     FILE *ofd;
  59.  
  60.     if((ofd = fopen(fname,"w")) == NULL)
  61.     {
  62.         printf("cannot create output file %s\n,fname");
  63.         exit(0);
  64.     }
  65.  
  66.     size = siz;
  67.     offset = off;
  68.  
  69.     printf("FILE <%s> contains %u bytes from %04x:%04x to %04x:%04x\n",
  70.         fname,size,SEGMENT,offset,SEGMENT,offset+(size-1));
  71.     for(;size;size--)
  72.     {
  73.         putc(peekbyte(offset++,SEGMENT),ofd);
  74.     }
  75.     fclose(ofd);
  76. }
  77.